#pragma once

#include <QGridLayout>
#include <QGroupBox>
#include <QHostAddress>
#include <QLabel>
#include <QListWidget>
#include <QPair>
#include <QTcpSocket>
#include <QVBoxLayout>
#include <QWidget>
#include "GameWindow.h"

class WaitingWindow : public QWidget {
    Q_OBJECT
private:
    QTcpSocket* socket;
    QString name;

    QLabel* title_label;
    QGroupBox* groupBox;
    QListWidget* player_list;

    QGridLayout* gridLayout;
    QVBoxLayout* widget_layout;

    GameWindow *gameWindow = nullptr;

public:
    explicit WaitingWindow(const QPair<QString, int>& address, QString name);

protected:
    void closeEvent(QCloseEvent* event) override;

public slots:
    void onReadyRead();
    void onErrorOccurred(QAbstractSocket::SocketError error);

signals:
#pragma clang diagnostic push
#pragma ide diagnostic ignored "NotImplementedFunctions"
    void closed();
#pragma clang diagnostic pop
};
